#ifndef DIRECTXCAPTURE_H
#define DIRECTXCAPTURE_H
#define D3DX

#include "IScreenCapture.h"
#ifdef D3DX
#include <d3d9.h>
#include <d3dx9.h>
#endif
#include <windows.h>
#include <QWidget>

class DirectXCapture : public IScreenCapture
{
#ifdef D3DX
		IDirect3D9* m_pD3D;
		IDirect3DDevice9* m_pd3dDevice;
		IDirect3DSurface9*  m_pSurface;
		IDirect3DSurface9* m_SelSurface;
#endif
		QWidget* parent;
		int ScreenWidth;
		int ScreenHeight;
		RECT SelRect;
		int WorkTime;

		QColor color;

		bool InitDirectX();
public:
		DirectXCapture(QWidget*);
		~DirectXCapture();

		void Capture();
		void Release();
		int GetTime();
		void MakeScreenshot(int x1, int y1, int x2, int y2);
		void SaveToFile(char* filename);
		QColor GetAverage();

};

#endif // DIRECTXCAPTURE_H
